package com.lgj.springboot_lgj.exception;
import com.lgj.springboot_lgj.utils.Result;
import com.lgj.springboot_lgj.utils.ResultUtil;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author lijun
 * @Date 2022/6/14
 */
@RestController
public class NotFoundExceptionHandler implements ErrorController {
    @GetMapping("/error")
    public Result error(HttpServletRequest request){
        return ResultUtil.error("访问的资源路径不存在:"+request.getRequestURI());//RESTful
    }
    @Override
    public String getErrorPath() {
        //不需要实现
        return null;
    }
}
